<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE NoImplicitPrelude #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Module      :  Data.Bool</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 2001</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- The 'Bool' type and related functions.</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Bool</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-19"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Booleans</span></span><span>
</span><span id="line-20"></span><span>   </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier">Bool</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>   </span><span class="annot"><span class="hs-comment">-- ** Operations</span></span><span>
</span><span id="line-22"></span><span>   </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator">(&amp;&amp;)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>   </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator">(||)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>   </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier">not</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>   </span><span class="annot"><a href="GHC.Base.html#otherwise"><span class="hs-identifier">otherwise</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>   </span><span class="annot"><a href="Data.Bool.html#bool"><span class="hs-identifier">bool</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-comment">-- | Case analysis for the 'Bool' type. @'bool' x y p@ evaluates to @x@</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- when @p@ is 'False', and evaluates to @y@ when @p@ is 'True'.</span><span>
</span><span id="line-33"></span><span class="hs-comment">--</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- This is equivalent to @if p then y else x@; that is, one can</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- think of it as an if-then-else construct with its arguments</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- reordered.</span><span>
</span><span id="line-37"></span><span class="hs-comment">--</span><span>
</span><span id="line-38"></span><span class="hs-comment">-- @since 4.7.0.0</span><span>
</span><span id="line-39"></span><span class="hs-comment">--</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- ==== __Examples__</span><span>
</span><span id="line-41"></span><span class="hs-comment">--</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- Basic usage:</span><span>
</span><span id="line-43"></span><span class="hs-comment">--</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- &gt;&gt;&gt; bool &quot;foo&quot; &quot;bar&quot; True</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- &quot;bar&quot;</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- &gt;&gt;&gt; bool &quot;foo&quot; &quot;bar&quot; False</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- &quot;foo&quot;</span><span>
</span><span id="line-48"></span><span class="hs-comment">--</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- Confirm that @'bool' x y p@ and @if p then y else x@ are</span><span>
</span><span id="line-50"></span><span class="hs-comment">-- equivalent:</span><span>
</span><span id="line-51"></span><span class="hs-comment">--</span><span>
</span><span id="line-52"></span><span class="hs-comment">-- &gt;&gt;&gt; let p = True; x = &quot;bar&quot;; y = &quot;foo&quot;</span><span>
</span><span id="line-53"></span><span class="hs-comment">-- &gt;&gt;&gt; bool x y p == if p then y else x</span><span>
</span><span id="line-54"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-55"></span><span class="hs-comment">-- &gt;&gt;&gt; let p = False</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- &gt;&gt;&gt; bool x y p == if p then y else x</span><span>
</span><span id="line-57"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-58"></span><span class="hs-comment">--</span><span>
</span><span id="line-59"></span><span id="local-6989586621679506540"><span class="annot"><a href="Data.Bool.html#bool"><span class="hs-identifier hs-type">bool</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679506540"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679506540"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679506540"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-60"></span><span id="bool"><span class="annot"><span class="annottext">bool :: forall a. a -&gt; a -&gt; Bool -&gt; a
</span><a href="Data.Bool.html#bool"><span class="hs-identifier hs-var hs-var">bool</span></a></span></span><span> </span><span id="local-6989586621679506534"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679506534"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679506534"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-61"></span><span class="annot"><a href="Data.Bool.html#bool"><span class="hs-identifier hs-var">bool</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679506533"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679506533"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679506533"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-62"></span></pre></body></html>